<template>
  <div
    :class="{
      'i-button': true,
      [`i-button--${type}`]: true,
    }"
  >
    <slot />
  </div>
</template>

<script setup>
import { defineProps, toRefs } from 'vue'

const props = defineProps({
  type: {
    type: String,
    default: 'primary',
  },
})

const { type } = toRefs(props)
</script>

<style scoped lang="scss">
.i-button {
  display: inline-block;
  height: 50px;

  font-family: PingFangSC-Semibold;
  font-size: 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 28px;

  user-select: none;
  cursor: pointer;

  column-gap: 12px;
  &:hover {
    opacity: 0.8;
  }

  &--primary {
    background-color: #0571b0;
    color: #fff;
  }

  &--danger {
    background-color: #ff0000;
    color: #fff;
    box-shadow: 0px 5px 10px 0px rgba(255, 0, 0, 0.2);
  }

  &--dashed {
    border: 1px solid #7fcfe2;
    color: #7fcfe2;
  }

  &--default {
    background-color: #fff;
    color: #0571b0;
    border: 1px solid #dddddd;
  }

  // 选择下一个兄弟元素
  & + & {
    margin-left: 20px;
  }
}
</style>
